package com.hckj.jianzhijia.controllers;

import android.content.Context;

import com.hckj.jianzhijia.utils.DataCheckUtil;
import com.hckj.jianzhijia.utils.ToastUtils;

/**
 * Created by 赵奇隆 on 2015-10-20.
 */
public class LoginController {

    private Context context;

    public LoginController(Context context) {
        this.context = context;
    }


    public boolean checkAllData(String phoneNum,String password){
        if(!DataCheckUtil.checkString(phoneNum)){
            ToastUtils.showToast(context,"请输入手机号码");
            return false;
        }

        if(!DataCheckUtil.checkString(password)){
            ToastUtils.showToast(context,"请输入您的密码");
            return false;
        }

        if(!DataCheckUtil.isMobile(phoneNum)){
            ToastUtils.showToast(context,"手机号码格式错误");
            return false;
        }

        if(!DataCheckUtil.isPassword(password)){
            ToastUtils.showToast(context,"密码长度在6-16位之间,且不能出现非法字符");
            return false;
        }

        return true;
    }
}
